<script setup>
import useMainStore from '@/stores/modules/main'
import { storeToRefs } from 'pinia'

const mainStore = useMainStore()
const { isLoading } = storeToRefs(mainStore)
</script>

<template>
  <div class="loading" v-if="isLoading" @click="isLoading = false">
    <div class="bg">
      <img src="@/assets/img/home/full-screen-loading.gif" alt="" />
    </div>
  </div>
</template>

<style lang="less" scoped>
.loading {
  z-index: 999;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  .bg {
    width: 104px;
    height: 104px;
    background-image: url(@/assets/img/home/loading-bg.png);
    background-size: 100% 100%;
    background-position: 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    img {
      margin-top: -10px;
      width: 72px;
      height: 72px;
    }
  }
}
</style>
